The single character at index (0-based), as a one-character string - getting a single character.
string_char_at(s, index) -> string| Name | Type |
|---|---|
s | string |
index | int |
string
The single character at index (0-based), as a one-character string - getting a single character.
index out of range (either side) is an empty string, never a crash. Returned as a string, not a number, so it composes directly with every other function in this group and with ==/< - GBML has no separate character type to convert to or from.
var name = "Ripley";
var initial = string_char_at(name, 0);
var starts_with_r = initial == "R";string_code_at is its partner: it counts the same way, but hands the character back as a number instead of as text.
Because a character is just a one-character string, a range check reads naturally too: "0" <= c && c <= "9" asks "is c a digit".
index out of range (either side) is an empty string, never a crash. Returned as a string, not a number, so it composes directly with every other function here and with `==`/`<` (e.g. `"0" <= c && c <= "9"` tests "is this character a digit") - GBML has no separate character type to convert to or from.